
{include('Layout/header')}
<div class="row row-bgcolor">
    <div class='col-md-12 content-title'>
        <h3>管理{if isset($parentName)} echo $parentName;{/if}分类</h3>
    </div>
    <div class='col-md-8 content col-md-offset-2'>
        <div class='artsort-act'>
            <a href="{\Rexzy::url('admin/asortadd')}{if $parent != 0}echo '?parent='.$parent;{/if}" id="add_artsort" class="artsort-btn">新增{if isset($parentName)} echo $parentName;{/if}分类</a>
        </div>

        <div class='table-list'>
            <table class="table table-hover">
                <colgroup>
                    <col width="10%">
                    <col width="30%">
                    <col width="25%">
                    <col width="20%">
                    <col width="15%">
                </colgroup>
                <thead>
                    <tr>
                        <th></th>
                        <th>名称</th>
                        <th>子分类</th>
                        <th>缩略名</th>
                        <th>文章数</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach $sort $key $mesg}
                    {php}
                        if ( $mesg['children'] == 0 ) {
                        $children = "<a class='line-btn' href='" . $addurl . "?parent=" . $mesg['sortid'] . "'>新增</a>";
                        } else {
                        $children = "<a class='line-btn' href='" . $sorturl . "?parent=" . $mesg['sortid'] . "'>" . $mesg['children'] . "个分类</a>";
                        }
                    {/php}
                        <tr><td><input class='select-box' type='checkbox' value="{$mesg['sortid']}"/></td><td>
                        <a class='sort-name line-btn' href="{$editurl}?sortid={$mesg['sortid']}">{$mesg['name']}</td><td>
                        {$children}</td><td>
                        {$mesg['slugname']}</td><td><span class='num-border'>
                        {$mesg['arts']}</span></td></tr>
                    {/foreach}
                </tbody>
            </table>
        </div>
        
        <div class='artsort-act'>
            <label class="checkbox-inline">
                <input type='checkbox' id='select_all' />选择全部
            </label>
            <a id="handle_artsort" class="artsort-btn">选中项<span class="glyphicon glyphicon-triangle-bottom handle-artsort-icon"></span></a>
            <ul class="nav nav-pills nav-stacked artsort-act-border">
                <li><a href="#" class='artsort-act-choice' id='artsort_delete_btn'>删除</a></li>
                <li><a href="#" class='artsort-act-choice'>合并</a></li>
            </ul>
            {if $parent != 0}
                echo "<a href='" . \Rexzy::url('admin/artsort');
                if ( $grdPar != 0 ) {
                    echo "?parent=" .$grdPar;
                }
                echo "' class='return-userlist'>返回" . $grdName . "分类列表</a>";
            {/if}
        </div>
    </div>
</div>


<script>
    $(function() {
        var warningMesg = "确定删除选中分类？";
        var handleUrl = url( 'admin/asortdelete');
        var parent = '{$parent}';
        if ( parent != 0 ){
            parent = '?parent=' + parent;
        } else {
            parent = '';
        }
        var goUrl = url( 'admin/artsort' + parent );
        deleteList( '#artsort_delete_btn', warningMesg, handleUrl, goUrl );
    });
</script>

{include('Layout/footer')}